﻿using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Effects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 纸片人.win2dEffectControl.DataClass
{
    internal class OpacityEffectData : EffectOneSourceData
    {
        private float _opcity = 1;

        /// <summary>
        /// 透明度
        /// </summary>
        public float Opacity
        {
            get { return _opcity; }
            set
            {
                _opcity = value;
                OnPropertyChanged();
                SetIsChanges();
            }
        }



        public override ICanvasImage GetEffect(CanvasDevice device, bool compression )
        {
            if (InputEffectData == null)
            {
                Size = new Windows.Foundation.Size(0, 0);
                return null;

            }

            var source = GetSourceEffect(device, compression);
            if (source == null)
            {
                Size = new Windows.Foundation.Size(0, 0);
                return null;
            }
            OpacityEffect effect = new OpacityEffect();
            effect.Source = source;
            effect.Opacity = Opacity;
            return effect;
        }



     


    }
}
